include $(SDK_DIR)/mk/sys_km.mk
# usw
ifeq ($(USW),yes)
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src -maxdepth 2 -name "*.c")

ifeq (duet2, $(filter duet2, $(chipname)))
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/duet2 -name "*.c")
CORE_USW_OBJS := $(patsubst %.c,%.o,$(CORE_USW_SRCS))
CORE_USW_OBJS := $(subst $(SDK_DIR)/core/usw/,,$(CORE_USW_OBJS))
CORE_USW_OBJS := $(sort $(CORE_USW_OBJS))
endif

ifeq (tsingma, $(filter tsingma, $(chipname)))
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/duet2 -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma -name "*.c")
CORE_USW_OBJS := $(patsubst %.c,%.o,$(CORE_USW_SRCS))
CORE_USW_OBJS := $(subst $(SDK_DIR)/core/usw/,,$(CORE_USW_OBJS))
CORE_USW_OBJS := $(sort $(CORE_USW_OBJS))
endif

ifeq (tsingma_mx, $(filter tsingma_mx, $(chipname)))
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/duet2 -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma_mx -name "*.c")
CORE_USW_OBJS := $(patsubst %.c,%.o,$(CORE_USW_SRCS))
CORE_USW_OBJS := $(subst $(SDK_DIR)/core/usw/,,$(CORE_USW_OBJS))
CORE_USW_OBJS := $(sort $(CORE_USW_OBJS))
endif

ifeq (tsingma_gx, $(filter tsingma_gx, $(chipname)))
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/duet2 -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma_mx -name "*.c")
CORE_USW_OBJS := $(patsubst %.c,%.o,$(CORE_USW_SRCS))
CORE_USW_OBJS := $(subst $(SDK_DIR)/core/usw/,,$(CORE_USW_OBJS))
CORE_USW_OBJS := $(sort $(CORE_USW_OBJS))
endif

ifeq (arctic, $(filter arctic, $(chipname)))
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/duet2 -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/tsingma_mx -name "*.c")
CORE_USW_SRCS += $(shell find $(SDK_DIR)/core/usw/src/sys/arctic -name "*.c")
CORE_USW_OBJS := $(patsubst %.c,%.o,$(CORE_USW_SRCS))
CORE_USW_OBJS := $(subst $(SDK_DIR)/core/usw/,,$(CORE_USW_OBJS))
CORE_USW_OBJS := $(sort $(CORE_USW_OBJS))
endif

endif

lib-m += $(CORE_USW_OBJS)
